package ldh.im.fxbase.data.pojo;

import ldh.im.fxbase.data.pojo.status.ImGroupUserStatus;

import java.util.Date;
import java.util.Objects;

public class ImGroupUser {

    private Long id;
    private Long groupId;
    private String userId;
    private String userName;
    private String remark;
    private Boolean isWaking;                 // 是否免打扰
    private Boolean isShowName;               // 是否显示用户名称
    private Boolean isTop;
    private Boolean isDisturb;
    private String ext1;
    private String ext2;
    private ImGroupUserStatus status;
    private Date createTime;
    private Date updateTime;

    private transient ImUser user;

    public ImGroupUser() {
        updateTime = new Date();
        createTime = updateTime;
        this.isWaking = false;
        this.isShowName = true;
        this.isTop = false;
        this.isDisturb = true;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Boolean getWaking() {
        return isWaking;
    }

    public void setWaking(Boolean waking) {
        isWaking = waking;
    }

    public Boolean getShowName() {
        return isShowName;
    }

    public void setShowName(Boolean showName) {
        isShowName = showName;
    }

    public Boolean getTop() {
        return isTop;
    }

    public void setTop(Boolean top) {
        isTop = top;
    }

    public Boolean getDisturb() {
        return isDisturb;
    }

    public void setDisturb(Boolean disturb) {
        isDisturb = disturb;
    }

    public ImGroupUserStatus getStatus() {
        return status;
    }

    public void setStatus(ImGroupUserStatus status) {
        this.status = status;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Long getGroupId() {
        return groupId;
    }

    public void setGroupId(Long groupId) {
        this.groupId = groupId;
    }

    public ImUser getUser() {
        return user;
    }

    public void setUser(ImUser user) {
        this.user = user;
        if (user != null) {
            this.userId = user.getUserId();
        }
    }

    public String getExt1() {
        return ext1;
    }

    public void setExt1(String ext1) {
        this.ext1 = ext1;
    }

    public String getExt2() {
        return ext2;
    }

    public void setExt2(String ext2) {
        this.ext2 = ext2;
    }

    @Override
    public int hashCode() {
        return Objects.hash(userId, groupId);
    }

    @Override
    public boolean equals(Object obj) {
        if (!(obj instanceof ImGroupUser)) return false;
        ImGroupUser gu = (ImGroupUser) obj;
        return gu.getUserId().equals(this.getUserId()) && gu.getGroupId().equals(this.getGroupId());
    }
}
